<!DOCTYPE html>
<html lang="zh">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>数据流分析报告</title>
    <style>
        body {
            margin: 0;
            padding: 20px;
            font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
            background-color: #f5f5f5;
            color: #333;
            line-height: 1.6;
        }
        .container {
            max-width: 1200px;
            margin: 0 auto;
            background-color: white;
            border-radius: 8px;
            box-shadow: 0 2px 4px rgba(0,0,0,0.1);
            padding: 30px;
        }
        .header {
            text-align: center;
            margin-bottom: 30px;
            padding-bottom: 20px;
            border-bottom: 2px solid #eee;
        }
        .header h1 {
            margin: 0;
            color: #2196F3;
            font-size: 28px;
        }
        .section {
            margin-bottom: 30px;
            padding: 20px;
            background-color: #f8f9fa;
            border-radius: 6px;
        }
        .section h2 {
            margin-top: 0;
            color: #333;
            font-size: 20px;
            border-bottom: 2px solid #e0e0e0;
            padding-bottom: 10px;
        }
        .stats-grid {
            display: grid;
            grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
            gap: 20px;
            margin-top: 20px;
        }
        .stat-card {
            background-color: white;
            padding: 15px;
            border-radius: 6px;
            box-shadow: 0 1px 3px rgba(0,0,0,0.1);
        }
        .stat-card h3 {
            margin: 0;
            color: #666;
            font-size: 14px;
            text-transform: uppercase;
        }
        .stat-card p {
            margin: 10px 0 0;
            font-size: 24px;
            font-weight: 500;
            color: #2196F3;
        }
        .flow-stats {
            margin-top: 20px;
        }
        .flow-stat {
            display: flex;
            justify-content: space-between;
            align-items: center;
            padding: 10px;
            background-color: white;
            border-radius: 4px;
            margin-bottom: 10px;
        }
        .flow-stat:last-child {
            margin-bottom: 0;
        }
        .flow-label {
            font-weight: 500;
            color: #333;
        }
        .flow-value {
            font-size: 18px;
            color: #2196F3;
        }
        .problem-list {
            margin-top: 20px;
        }
        .problem-item {
            background-color: white;
            padding: 15px;
            margin-bottom: 15px;
            border-radius: 6px;
            box-shadow: 0 1px 3px rgba(0,0,0,0.1);
        }
        .problem-item:last-child {
            margin-bottom: 0;
        }
        .problem-header {
            display: flex;
            justify-content: space-between;
            align-items: center;
            margin-bottom: 10px;
        }
        .problem-title {
            font-weight: 500;
            color: #f57c00;
        }
        .problem-type {
            padding: 4px 8px;
            border-radius: 4px;
            font-size: 12px;
            font-weight: 500;
            background-color: #fff3e0;
            color: #f57c00;
        }
        .problem-details {
            margin-top: 10px;
            padding-top: 10px;
            border-top: 1px solid #eee;
        }
        .problem-details p {
            margin: 5px 0;
            color: #666;
        }
        .recommendation {
            margin-top: 10px;
            padding: 10px;
            background-color: #f5f5f5;
            border-radius: 4px;
        }
        .recommendation h4 {
            margin: 0;
            color: #333;
            font-size: 14px;
        }
        .recommendation p {
            margin: 5px 0 0;
            color: #666;
        }
        .footer {
            margin-top: 30px;
            padding-top: 20px;
            border-top: 2px solid #eee;
            text-align: center;
            color: #666;
            font-size: 14px;
        }
    </style>
</head>
<body>
    <div class="container">
        <div class="header">
            <h1>数据流分析报告</h1>
        </div>
        
        <div class="section">
            <h2>变量统计</h2>
            <div class="stats-grid">
                <div class="stat-card">
                    <h3>变量总数</h3>
                    <p>{变量统计[总数]}</p>
                </div>
                <div class="stat-card">
                    <h3>已定义变量</h3>
                    <p>{变量统计[已定义]}</p>
                </div>
                <div class="stat-card">
                    <h3>已使用变量</h3>
                    <p>{变量统计[已使用]}</p>
                </div>
                <div class="stat-card">
                    <h3>未使用变量</h3>
                    <p>{变量统计[未使用]}</p>
                </div>
            </div>
        </div>
        
        <div class="section">
            <h2>数据流统计</h2>
            <div class="flow-stats">
                <div class="flow-stat">
                    <span class="flow-label">总流向数</span>
                    <span class="flow-value">{流向统计[总数]}</span>
                </div>
                <div class="flow-stat">
                    <span class="flow-label">定义流向</span>
                    <span class="flow-value">{流向统计[定义流]}</span>
                </div>
                <div class="flow-stat">
                    <span class="flow-label">使用流向</span>
                    <span class="flow-value">{流向统计[使用流]}</span>
                </div>
                <div class="flow-stat">
                    <span class="flow-label">修改流向</span>
                    <span class="flow-value">{流向统计[修改流]}</span>
                </div>
            </div>
        </div>
        
        <div class="section">
            <h2>问题变量分析</h2>
            <div class="problem-list">
                <!-- 由JavaScript动态填充 -->
            </div>
        </div>
        
        <div class="footer">
            <p>生成时间: <span id="timestamp"></span></p>
        </div>
    </div>
    
    <script>
        // 设置生成时间
        document.getElementById('timestamp').textContent = new Date().toLocaleString();
        
        // 填充问题变量信息
        const problems = {问题变量};
        const problemList = document.querySelector('.problem-list');
        
        if (problems.length === 0) {
            problemList.innerHTML = '<p style="text-align: center; color: #666;">未发现问题变量</p>';
        } else {
            problems.forEach((problem, index) => {
                const div = document.createElement('div');
                div.className = 'problem-item';
                div.innerHTML = `
                    <div class="problem-header">
                        <span class="problem-title">问题 #${index + 1}</span>
                        <span class="problem-type">${problem.类型}</span>
                    </div>
                    <div class="problem-details">
                        <p><strong>变量:</strong> ${problem.变量}</p>
                        <p><strong>描述:</strong> ${problem.描述}</p>
                        <div class="recommendation">
                            <h4>优化建议</h4>
                            <p>${problem.建议}</p>
                        </div>
                    </div>
                `;
                
                problemList.appendChild(div);
            });
        }
    </script>
</body>
</html> 